package com.atguigu.gmall.pms.api;

import com.atguigu.gmall.common.bean.PageParamVo;
import com.atguigu.gmall.common.bean.ResponseVo;
import com.atguigu.gmall.pms.entity.*;
import com.atguigu.gmall.pms.vo.ItemGroupVo;
import com.atguigu.gmall.pms.vo.SaleAttrValueVo;
import org.springframework.web.bind.annotation.*;

import java.util.List;

public interface GmallPsmApi {

    //1.分页查询spu
    @PostMapping("pms/spu/json")
    ResponseVo<List<SpuEntity>> querySpuByPageJson(@RequestBody PageParamVo paramVo);

    //根据spuId查询spu信息
    @GetMapping("pms/spu/{id}")
    ResponseVo<SpuEntity> querySpuById(@PathVariable("id") Long id);

    //2.根据spuId查询sku
    @GetMapping("pms/sku/spu/{spuId}")
    ResponseVo<List<SkuEntity>> querySkusBySpuId(@PathVariable("spuId")Long spuId);

    //根据skuId查询sku
    @GetMapping("pms/sku/{id}")
    ResponseVo<SkuEntity> querySkuById(@PathVariable("id") Long id);

    //4.根据品牌id查询品牌
    @GetMapping("pms/brand/{id}")
    ResponseVo<BrandEntity> queryBrandById(@PathVariable("id") Long id);

    //5.根据分类id查询分类
    @GetMapping("pms/category/{id}")
    ResponseVo<CategoryEntity> queryCategoryById(@PathVariable("id") Long id);

    //根据父节点id查询分类列表
    @GetMapping("pms/category/parent/{parentId}")
    ResponseVo<List<CategoryEntity>> getInfoByParentId(@PathVariable("parentId")Long parentId);

    //根据父id查询2、3级份分类
    @GetMapping("pms/category/level/23/{pid}")
    ResponseVo<List<CategoryEntity>> queryLevel23CategoriesByPid(@PathVariable("pid")Long pid);

    //根据三级分类查询一二三级分类信息
    @GetMapping("pms/category/level/123/{cid}")
    ResponseVo<List<CategoryEntity>> queryCategoriesByCid(@PathVariable("cid")Long cid);

    //6.根据skuId和分类id查询销售类型的检索属性和值
    @GetMapping("pms/skuattrvalue/search/skuattrvalue/{cid}")
     ResponseVo<List<SkuAttrValueEntity>> querySkuAttrValuesByCidAndskuId(
            @PathVariable("cid")Long cid,
            @RequestParam("skuId")Long skuId
    );

    //根据skuId查询当前sku的销售属性
    @GetMapping("pms/skuattrvalue/sku/{skuId}")
    ResponseVo<List<SkuAttrValueEntity>> querySkuAttrsBySkuId(@PathVariable("skuId")Long skuId);

    //同一个sup下的所有销售属性的集合
    @GetMapping("pms/skuattrvalue/spu/{spuId}")
    ResponseVo<List<SaleAttrValueVo>> querySaleAttrValuesBySupId(@PathVariable("spuId")Long spuId);

    //根据spuId查询spu下所有销售属性组合与skuId的映射关系
    @GetMapping("pms/skuattrvalue/mapping/{spuId}")
    ResponseVo<String> queryMappingBySpuId(@PathVariable("spuId")Long spuId);

    //7.根据spuID和分类id查询基本类型的检索属性和值
    @GetMapping("pms/spuattrvalue/search/spuattrvalue/{cid}")
    ResponseVo<List<SpuAttrValueEntity>> querySpuAttrValuesByCidAndSpuId(
            @PathVariable("cid")Long cid,
            @RequestParam("spuId")Long spuId
    );

    //根据skuId查询sku的图片列表
    @GetMapping("pms/skuimages/sku/{skuId}")
    ResponseVo<List<SkuImagesEntity>> queryImagesBySkuId(@PathVariable("skuId")Long skuId);

    //根据spuId查询spu的海报信息
    @GetMapping("pms/spudesc/{spuId}")
    ResponseVo<SpuDescEntity> querySpuDescById(@PathVariable("spuId") Long spuId);

    //查询规格参数分组及组下的规格参数和值
    @GetMapping("pms/attrgroup/with/attr/value/{cid}")
    ResponseVo<List<ItemGroupVo>> queryGroupWithAttrValueByCidAndSkuIdAndSpuId(
            @PathVariable("cid")Long cid,
            @RequestParam("skuId")Long skuId,
            @RequestParam("spuId")Long spuId
    );
}
